import {
  Column,
  Entity,
  PrimaryGeneratedColumn,
  Tree,
  TreeChildren,
  TreeParent,
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';

@Entity()
@Tree('closure-table')
export default abstract class CommonTree {
  @PrimaryGeneratedColumn()
  id: number;
  @ApiProperty({ type: 'string', example: '大哥' })
  @Column()
  title: string;
  @TreeChildren()
  children: CommonTree[];
  @TreeParent()
  parent: CommonTree;
}
